Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home Page Prep #37

Merged
merged 25 commits into from
Jun 21, 2024
Merged

Home Page Prep #37

merged 25 commits into from
Jun 21, 2024

Conversation

jtcaovan
Copy link
Collaborator

@jtcaovan jtcaovan commented Jun 13, 2024

Pull Request Template

Issue Overview

This PR addresses #168

  • This change addresses the issue in full
  • This change addresses only certain aspects of the issue
  • This change is a dependency for another issue
  • This change has a dependency from another issue

Description

This PR removes the previous sheltertech homepage and replaces it with our new components. Changes are made across all components to account for change in data fetching and styling.

  • Hero
  • Category Cards
  • Opportunity Cards
  • Event Cards
  • Two Column Content

Note: Newsletter component is still needed

How Can This Be Tested/Reviewed?

Run local env and view home page. Should match up to Figma designs here. There are a lot of diffs since I had to replace the previous home page, move all of the data fetching into the home page, and style each component to fit. Would probably be best to view home page first for visual issues then review code quality after

  • Instead of fetching the data in each separate component, the data is now all fetched on the home page
  • Wraps home page components with HomePageSection - content should have a max width and background color should expand full width
  • Fixes issue with Two Column Content image disappearing on smaller breakpoints
  • Adds focus/active states to opp/event cards
  • Review code quality
  • Editing the home page fields in Sanity should immediately update the home page
    https://our415.sanity.studio/development/structure/homePage;293c2d9c-0bba-4335-9532-3937f6dc9d86

Checklist:

  • My code follows the style guidelines of this project
  • I have added QA notes to the issue with applicable URLs
  • I have performed a self-review of my own code
  • I have reviewed the changes in a desktop view
  • I have reviewed the changes in a mobile view
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have assigned reviewers
  • My commit message(s) is/are polished, and any breaking changes are indicated in the message and are well-described

Reviewer Notes:

Steps to review a PR:

  • Read and understand the issue, and ensure the author has added QA notes
  • Review the code itself from a style point of view
  • Pull the changes down locally and test that the acceptance criteria is met
  • Also review the acceptance criteria on the Netlify deploy preview (noting that these do not yet include any backend changes made in the PR)
  • Either explicitly ask a clarifying question, request changes, or approve the PR if there are small remaining changes but the PR is otherwise good to go

On Merge:

If you have one commit and message, squash. If you need each message to be applied, rebase and merge.

categoriesSection: FeaturedCategoriesData;
opportunitySection: OppEventCardData;
eventSection: OppEventCardData;
/* Fix naming in Sanity schema */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of putting this comment here but I don't understand it without context. Can you please add a couple more sentences to explain what you are fixing?

/>
<OppEventCardSection sectionType="event" sectionData={eventSection} />
<TwoColumnContentSection {...twoColumnContentData} />
{/* Newsletter Component */}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a ticket in Notion you could reference here in case someone else has to pick up the work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 36 to 54
// button {
// @extend %font-size-default;
// border: 0;
// // height: calc-em(44px);
// padding: calc-em(6px) calc-em(20px);
// color: $color-white;
// background: $color-green;
// display: inline-block;
// font-weight: 600;
// &:active,
// &:hover,
// &:focus {
// box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
// }

&.danger {
background: $color-red;
}
}
// &.danger {
// background: $color-red;
// }
// }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep or 🧹 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹

Comment on lines 106 to 107
// Remove when new categories is created
// other components are dependent on this list
Copy link
Collaborator

@rosschapman rosschapman Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: consider adding a TODO or similar label so this isn't mistaken with explaining behavior. IME these comments sometimes accidentally stick around and become esoteric erratum to be deciphered by future archeologists under candlelight.

(section: JSX.IntrinsicAttributes & TwoColumnContentSection) => {
return <TwoColumnContentSection key={section._id} {...section} />;
(section: JSX.IntrinsicAttributes & TwoColumnContent) => {
return <TwoColumnContentSection key={section.key} {...section} />;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why you change to key here. I also don't see it on any type declaration in this PR (though admittedly I'm ignorant of the codebase and would believe it's somewhere else.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that, I reverted back to using _id here

fetchHomePageData();
}, []);

if (!homePageData) {
Copy link
Collaborator

@rosschapman rosschapman Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: do an exact null check here to be clear about runtime expectations matching the type. Otherwise I would second guess that the value of homePageData could be a falsy value other than null.

Suggested change
if (!homePageData) {
if (homePageData === null) {

}
}`;

const result: HomePageData = await client.fetch(query);
Copy link
Collaborator

@rosschapman rosschapman Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we punting on error handling for the time being? Or the Sanity API returning a structurally correct type but with empty data? That's ok, I'm just curious because if Sanity sent something back unexpected I wonder about the consequences.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in error handling!

Copy link
Collaborator

@rosschapman rosschapman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @jtcaovan! I think I get the gist of what's going on here. Normally when getting to know a codebase I'd spend some time with you synchronously to talk more about it. But I know y'all are cooking toward the deadline. All seems reasonable to me. No pressure to resolve my questions before merging.

children,
}: {
title: string;
title?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this optionality seems like good correction!


const { header, subheader, backgroundColor, featuredCategoriesSection } =
sectionData;
const categories = featuredCategoriesSection[0].category;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, strange asymmetry between categories and category.

@jtcaovan jtcaovan merged commit 7fb276c into development Jun 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants